﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using iShoppingBUS;

namespace iShopping.Manager
{
    public partial class ThongKeSanPham : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnTheoThang_Click(object sender, EventArgs e)
        {
            //Create some dummy Data  

            Random random = new Random();

            DataTable dt = ThongKeBUS.SanPhamTheoThangBUS(int.Parse(txtTheoThang.Text));

            for (int pointIndex = 0; pointIndex < dt.Rows.Count; pointIndex++)
            {
                Chart1.Series["Series1"].Points.AddXY(int.Parse(dt.Rows[pointIndex]["Thang"].ToString()), int.Parse(dt.Rows[pointIndex]["SL_CTGD"].ToString()));

            }//Set the chart type  
            Chart1.ChartAreas["ChartArea1"].AxisX.Title = "Tháng";
            Chart1.ChartAreas["ChartArea1"].AxisY.Title = "Số Sản Phẩm Giao Dịch";
            Chart1.Series["Series1"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Column;// Set the Pie width  

            Chart1.Series["Series1"]["PointWidth"] = "0.5";// Show data points labels  

            Chart1.Series["Series1"].IsValueShownAsLabel = true;// Set data points label style  

            Chart1.Series["Series1"]["BarLabelStyle"] = "Center";// Show chart as 3D  

            Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;// Draw chart as 3D   


            Chart1.Series["Series1"]["DrawingStyle"] = "Cylinder";
        }

        protected void btnTheoQuy_Click(object sender, EventArgs e)
        {
            //Create some dummy Data  

            Random random = new Random();

            for (int pointIndex = 1; pointIndex <= 4; pointIndex++)
            {

                Chart1.Series["Series1"].Points.AddY(ThongKeBUS.SanPhamTheoQuyBUS(int.Parse(txtTheoThang.Text), pointIndex));

            }//Set the chart type  
            Chart1.ChartAreas["ChartArea1"].AxisX.Title = "Qúy";
            Chart1.ChartAreas["ChartArea1"].AxisY.Title = "Số Sản Phẩm Giao Dịch";
            Chart1.Series["Series1"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Column;// Set the Pie width  

            Chart1.Series["Series1"]["PointWidth"] = "0.5";// Show data points labels  

            Chart1.Series["Series1"].IsValueShownAsLabel = true;// Set data points label style  

            Chart1.Series["Series1"]["BarLabelStyle"] = "Center";// Show chart as 3D  

            Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;// Draw chart as 3D   


            Chart1.Series["Series1"]["DrawingStyle"] = "Cylinder";
        }

        protected void btnNam_Click(object sender, EventArgs e)
        {
            DataTable dt = ThongKeBUS.SanPhamGiaoDichTheoNamBUS();

            for (int pointIndex = 0; pointIndex < dt.Rows.Count; pointIndex++)
            {
                Chart1.Series["Series1"].Points.AddXY(int.Parse(dt.Rows[pointIndex]["Nam"].ToString()), int.Parse(dt.Rows[pointIndex]["SL_CTGD"].ToString()));

            }//Set the chart type  
            Chart1.ChartAreas["ChartArea1"].AxisX.Title = "Năm";
            Chart1.ChartAreas["ChartArea1"].AxisY.Title = "Số Lượng Sản Phẩm Giao Dịch";
            Chart1.Series["Series1"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Column;// Set the Pie width  

            Chart1.Series["Series1"]["PointWidth"] = "0.5";// Show data points labels  

            Chart1.Series["Series1"].IsValueShownAsLabel = true;// Set data points label style  

            Chart1.Series["Series1"]["BarLabelStyle"] = "Center";// Show chart as 3D  

            Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;// Draw chart as 3D   


            Chart1.Series["Series1"]["DrawingStyle"] = "Cylinder";
        }
    }
}
